﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AssetsSys.model
{
    public class AssetsContext : DbContext
    {
        public AssetsContext() : base("con")
        {
            Database.SetInitializer<DbContext>(null);
        }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            //关闭一对多和多对多的级联操作
            modelBuilder.Conventions.Remove<OneToManyCascadeDeleteConvention>();
            modelBuilder.Conventions.Remove<ManyToManyCascadeDeleteConvention>();
        }

        public DbSet<Assets> Assetses { get; set; }
        public DbSet<Department> Departments { get; set; }
        public DbSet<Permission> Permission { get; set; }
        public DbSet<Fixup> Fixups { get; set; }
        public DbSet<Modify> Modifies { get; set; }
        public DbSet<Source> Sources { get; set; }
        public DbSet<Status> Statuses { get; set; }
        public DbSet<Type> Types { get; set; }
        public DbSet<User> SysUsers { get; set; }

    }
}
